package com.turing.post.account.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 子帐户
 * 
 * @author kz
 * @date 2012-12-17
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "SubAccount")
public class SubAccount implements Serializable {

	public SubAccount() {
		super();
	}

	/**
	 * 子帐号
	 */
	private BigInteger subAccNo;
	/**
	 * 主帐号
	 */
	private BigInteger masterAccNo;
	/**
	 * 开户机构号
	 */
	private String openBranchNo;
	/**
	 * 开户时间
	 */
	private Date openTime;
	/**
	 * 上次记帐时间
	 */
	private Date lastAccountTime;
	/**
	 * 销售员组ID
	 */
	private BigInteger salesGroupId;
	/**
	 * 余额
	 */
	private BigInteger balance;
	/**
	 * 应用ID
	 */
	private BigInteger appId;

	/**
	 * 应用序列号
	 */
	private String AppSeqNo;

	@Id
	@Column(name = "SUBACCNO", nullable = false)
	public BigInteger getSubAccNo() {
		return subAccNo;
	}

	public void setSubAccNo(BigInteger subAccNo) {
		this.subAccNo = subAccNo;
	}

	@Column(name = "MASTERACCNO", nullable = false)
	public BigInteger getMasterAccNo() {
		return masterAccNo;
	}

	public void setMasterAccNo(BigInteger masterAccNo) {
		this.masterAccNo = masterAccNo;
	}

	@Column(name = "OPENBRANCHNO", nullable = false)
	public String getOpenBranchNo() {
		return openBranchNo;
	}

	public void setOpenBranchNo(String openBranchNo) {
		this.openBranchNo = openBranchNo;
	}

	@Column(name = "OPENTIME", nullable = false)
	public Date getOpenTime() {
		return openTime;
	}

	public void setOpenTime(Date openTime) {
		this.openTime = openTime;
	}

	@Column(name = "LASTACCOUNTTIME", nullable = false)
	public Date getLastAccountTime() {
		return lastAccountTime;
	}

	public void setLastAccountTime(Date lastAccountTime) {
		this.lastAccountTime = lastAccountTime;
	}

	@Column(name = "SALESGROUPID", nullable = true)
	public BigInteger getSalesGroupId() {
		return salesGroupId;
	}

	public void setSalesGroupId(BigInteger salesGroupId) {
		this.salesGroupId = salesGroupId;
	}

	@Column(name = "BALANCE", nullable = false)
	public BigInteger getBalance() {
		return balance;
	}

	public void setBalance(BigInteger balance) {
		this.balance = balance;
	}

	@Column(name = "AppSeqNo")
	public String getAppSeqNo() {
		return AppSeqNo;
	}

	public void setAppSeqNo(String appSeqNo) {
		AppSeqNo = appSeqNo;
	}

	/**
	 * 增加发生额
	 * 
	 * @param amt
	 */
	public void addAmount(BigInteger amt) {
		this.setBalance(this.getBalance().add(amt));
	}

	@Column(name = "APPID", nullable = true)
	public BigInteger getAppId() {
		return appId;
	}

	public void setAppId(BigInteger appId) {
		this.appId = appId;
	}
}
